<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <!-- header -->
    <%@ include file="/WEB-INF/views/include/header.jsp" %>
    <%--多附件上传css--%>
    <link rel="stylesheet" href="<s:url value="/assets/css/main.css"></s:url>"/>
    <style>
        body{
            background: #fff;
        }
        body.dragging, body.dragging * {
            cursor: move !important;
        }
        .dragged {
            position: absolute;
            opacity: 0.5;
            z-index: 2000;
        }
        #example li.placeholder {
            position: relative;
            /** More li styles **/
        }
        #example li.placeholder:before {
            position: absolute;
            /** Define arrowhead **/
        }
        .bottons {
            width: 400px;
            height: 30px;
            line-height: 30px;
            text-align: center;
            border-bottom: 1px solid #333;
            display: flex;
            flex-flow: row nowrap;
        }
        .bottons div {
            width: 100px;
            color: #000;
            background-color: rgba(0, 0, 0, 0.1);
            border: 1px solid white;
            border-radius: 3px;
            margin-left: 1px;
            cursor: pointer;
        }
        .bottons div:nth-child(1) {
            margin-left: 0;
        }
        .bottons > .bottonactive {
            background-color: white;
            border: 1px solid #999;
            color: #0d43fa;
        }
        /*页面*/
        .page {
            width: 98%;
            margin: 0 auto;
        }
        .page1 {
            display: block;
        }
        .page2 {
            display: none;
        }
        .page3 {
            display: none;
            padding: 20px 0;
        }
        /*页面1，督办详情*/
        .flex_bet {
            display: flex;
            justify-content: flex-start;
            align-items: baseline;
        }

        .v_mid {
            vertical-align: middle;
        }

        .mglr30 {
            margin: 0 30px;
        }

        .mgb10 {
            margin-bottom: 10px;
        }

        .mgb16 {
            margin-bottom: 16px;
        }

        .mgr10 {
            margin-right: 10px;
        }



        .db_btn {
            border: 0;
            outline: 0;
            text-align: center;
            line-height: 32px;
            width: 66px;
            height: 32px;
            color: #fff;
            border-radius: 5px;
        }

        .db_btn_abled {
            background: #337AB7;
        }

        .db_btn_abled:hover {
            opacity: 0.8;
        }

        .db_btn_disabled {
            background: #ddd;
        }

        .db_btn_disabled:hover {
            cursor: not-allowed;
        }


        .btn_download {
            border: 0;
            outline: 0;
            text-align: center;
            line-height: 30px;
            width: 50px;
            height: 30px;
            background: #108EE9;
            color: #fff;
            border-radius: 5px;
        }

        .btn_download:hover {
            opacity: 0.8;
        }

        .panel_wrapper {
            padding: 30px;
            border: 1px solid #ddd;
            border-radius: 5px;
        }

        .panel_wrapper .panel_title {
            font-size: 20px;
            text-align: center;
        }

        .db_header_wrapper {
            padding: 40px;
        }

        .file_name {
            display: inline-block;
            width: 200px;
            margin-bottom: 15px;
        }

        .form_wrapper {
            padding: 30px;
        }

        .form_wrapper .item_line {
            display: flex;
            justify-content: flex-start;
            align-items: center;
        }

        .form_wrapper .item_line textarea {
            border: 1px solid #ddd;
            outline: 0;
            border-radius: 5px;
            width: 94%;
            padding: 5px;
        }

        .form_wrapper .item_line .btn_finish {
            border: 0;
            outline: 0;
            text-align: center;
            line-height: 30px;
            width: 100px;
            height: 30px;
            background: #169BD5;
            color: #fff;
            border-radius: 5px;
        }

        .form_wrapper .item_line .btn_finish:hover {
            opacity: 0.8;
        }

        .form_wrapper .item_line .btn_return {
            border: 0;
            outline: 0;
            text-align: center;
            line-height: 30px;
            width: 100px;
            height: 30px;
            background: #D9001B;
            color: #fff;
            border-radius: 5px;
        }

        .form_wrapper .item_line .btn_return:hover {
            opacity: 0.8;
        }
        /*页面2，反馈汇总*/
        .page2_caption {
            width: 100%;
            text-align: center;
            margin-top: 20px;
            font-size: 16px;
        }
        .page2_top{
            width: 100%;
            margin-top: 10px;
        }
        .page2_top_div{
            width: 100%;
            padding: 0 10px;
        }
        .page2_top_div div{
            display: inline-block;
            height: 30px;
            line-height: 30px;
        }
        .page2_top_div_text1{
            width: 110px;
            text-align: left;
            font-size: 12px;
        }
        .page2_top_div_text2{
            width: 150px;
            text-align: left;
            font-size: 12px;
        }
        .page2_top_div_text3{
            width: 110px;
            text-align: left;
            font-size: 14px;
            font-weight: 400;
        }
        .page2_center{
            width: 100%;
            position: relative;
            margin-top: 10px;
        }
        .page2_center_div{
            width: 110px;
            text-align: left;
            font-size: 12px;
            padding: 0 10px;
            position: absolute;
            top: 0;
            left: 0;
        }
        #getFile{
            margin-left: 110px;
        }
        .page2_bottom{
            width: 90%;
            margin: 30px auto;
            position: relative;
            padding: 10px 0;
        }
        .page2_bottom_title{
            font-size: 12px;
            position: absolute;
            left: 0;
            top: 0;
        }
        .page2_bottom_info{
            width: 80%;
            margin: 0 auto;
        }
        .page2_bottom_info_tr{
            width: 100%;
            height: 30px;
            line-height: 30px;
            border-bottom: 1px solid rgba(0,0,0,0.03);
            display: flex;
            flex-flow: row nowrap;
            text-align: center;
        }
        .page2_bottom_info_th{
            flex: 1;
            color: rgba(0,0,0,0.3);
            font-size: 12px;
        }
        .page2_bottom_info_td{
            flex: 1;
            color: rgba(0,0,0,0.5);
            font-size: 14px;
        }
        /*.page2_bottom_info_th:nth-child(1){*/
        /*    flex: 3;*/
        /*    text-align: left;*/
        /*}*/
        /*.page2_bottom_info_td:nth-child(1){*/
        /*    flex: 3;*/
        /*    text-align: left;*/
        /*}*/
        .reverseRank{
            cursor: pointer;
        }
        .page2_buttons{
            width: 100%;
            margin-top: 20px;
            margin-bottom: 60px;
        }
        .page2_buttons button{
            float: right;
            color: white;
            padding: 3px 5px;
            background-color: rgba(135, 184, 127,1);
            box-shadow: 3px 3px 3px rgba(0,0,0,0.5);
            margin-right: 5px;
            border-radius: 3px;
            border: none;
            font-size: 12px;
        }
        .page2_buttons .page2_buttons_click{
            background-color: rgba(0, 0, 0,0.3);
        }
        .page2_buttons_click:hover {
             cursor: not-allowed;
         }
        .thetextarea{
            width:100%;
            padding: 3px 10px;
            font-size: 12px;
            display: flex;
            flex-flow: row nowrap;
        }
        .thetextarea div:nth-child(1){
            width: 100px;
            text-align: left;
        }
        .thetextarea div:nth-child(2){
            flex: 1;
        }
        .thetextarea textarea{
            display: inline-block;
            width: 90%;
        } /* 记录 */
        .record{
            padding-bottom: 10px;
        }
        .record_caption {
            width: 500px;
            height: 60px;
            margin: 15px auto;
            display: flex;
            flex-flow: row nowrap;
        }
        .record_hr {
            width: 130px;
            height: 4px;
            background-color: #333;
            margin-top: 28px;
        }
        .caption_text {
            width: 240px;
            height: 60px;
            line-height: 60px;
            font-size: 25px;
            text-align: center;
            color: #333;
            font-weight: 500;
        }
        .allrecord{
            width: 100%;
        }
        .record {
            width: 100%;
            background-color: rgba(0, 0, 0, 0.03);
            margin-top: 20px;
        }
        .record_title {
            height: 40px;
            line-height: 40px;
            display: flex;
            flex-flow: row nowrap;
            text-align: left;
            background-color: rgba(0, 0, 0, 0.1);
            padding: 0 20px;
            margin-bottom: 20px;
        }
        .record_div {
            height: 40px;
            line-height: 20px;
            display: flex;
            flex-flow: row nowrap;
            text-align: left;
            padding: 0 20px;
        }
        .record_div2 {
            line-height: 20px;
            display: flex;
            flex-flow: row nowrap;
            text-align: left;
            padding: 0 20px;
        }
        .record_text1 {
            width: 110px;
        }
        .record_text2 {
            flex: 1;
        }
        .record_text3 {
            flex: 1;
            line-height: 20px;
            white-space: normal;
            word-break: break-all;
            word-wrap: break-word;
        }
        .record_text3 .download_text{
            margin-bottom: 10px;
        }
        .record_text3 .download_botton {
            display: inline-block;
            width: 60px;
            height: 25px;
            line-height: 25px;
            text-align: center;
            color: white;
            background-color: #0e84ff;
            border-radius: 5px;
            margin-left: 20px;
            cursor: pointer;
        }
        /*页面3，督察流程记录*/
        .taskFlex{
            display: flex;
            align-items: center;
            padding: 5px 10px;
        }
        .taskLine {
            display: flex;
            align-items: center;
        }
        .taskFlex div:nth-child(1){
            font-size: 16px;
            margin-right: 10px;
        }
        .taskFlex div:nth-child(2) {
            font-size: 12px;
        }
        .taskName3{
            margin-right: 10px;
        }
        .taskTabel{
            border: 1px solid rgba(230, 235, 247, 1);
            padding: 20px;
            box-shadow: 0px 4px 16px 0px rgba(39, 97, 228, 0.3);
            border-radius: 4px;
            margin-top: 20px;
        }
        .taskTr{
            display: flex;
            margin: 5px 0;
            align-items: center;
            font-size: 12px;
            color: #999;
        }
        .taskTr div:nth-child(1){
            margin-right: 10px;
            font-size: 14px;
            color: #333;
        }
        .page4{
            padding-top: 50px;
            display: none;
        }
    </style>
</head>
<body>
<div class="bottons">
    <div class="thebotton bottonactive">反馈汇总</div>
    <div class="thebotton">牵头单位反馈</div>
    <div class="thebotton">督察流程记录</div>
    <div class="thebotton">子事项列表</div>
</div>
<input id="specialTask_taskMainId" type="hidden" value="${specialTask.taskMainId}" />
<input id="specialTask_type" type="hidden" value="${specialTask.type}" />
<input id="specialTask_evaluations" type="hidden" value="${specialTask.evaluations}" />
<input id="mainTask_mainResult" type="hidden" value="${ mainTask.mainResult}" />
<input id="specialTask_timeRound" type="hidden" value="${ specialTask.timeRound}" />
<input id="specialTask_sysId" type="hidden" value="${ specialTask.sysId}" />
<input id="specialTask_pagetype" type="hidden" value="${pageType}" />
<div class="page page2">
    <div class="page2_caption">${mainTask.mainName}</div>
    <div class="page2_top">
<%--        <div class="page2_top_div">--%>
<%--            <div class="page2_top_div_text3">任务名称：</div>--%>
<%--            <div class="page2_top_div_text3" style="width: 250px;"></div>--%>
<%--        </div>--%>
        <div class="page2_top_div">
            <div class="page2_top_div_text1">反馈时限：</div>
            <div class="page2_top_div_text2">${specialTask.roundLimit}</div>
            <div class="page2_top_div_text1">反馈轮次：</div>
            <div class="page2_top_div_text2">${specialTask.timeRound}</div>
        </div>
        <div class="page2_top_div">
            <div class="page2_top_div_text1">办理情况：</div>
            <div class="page2_top_div_text2" id="specialTask_type_div"></div>
            <%--<div class="page2_top_div_text1">反馈时间：</div>
            <div class="page2_top_div_text2">XX</div>--%>
        </div>
        <div class="page2_top_div">
            <div class="page2_top_div_text1">督查办结评价：</div>
            <div class="page2_top_div_text2">${specialTask.evaluations}</div>
        </div>
        <div class="page2_top_div">
            <div class="page2_top_div_text1">督查组回复：</div>
            <div class="page2_top_div_text2">${specialTask.feedbacks}</div>
        </div>
        <div class="page2_top_div">
            <div class="page2_top_div_text3">督办单位：</div>
            <div class="page2_top_div_text3">${overdueDept.deptName}</div>
        </div>
    </div>
    <div class="page2_bottom">
        <div class="page2_bottom_title">承办单位排名：</div>
        <div class="page2_bottom_info">
            <div class="page2_bottom_info_tr">
                <div class="page2_bottom_info_th">单位</div>
                <div class="page2_bottom_info_th">评价</div>
<%--                <div class="page2_bottom_info_th reverseRank">本轮排名</div>--%>
<%--                <div class="page2_bottom_info_th">平均排名</div>--%>
            </div>
            <div class="page2_bottom_info_bottom" id="dubanChance"></div>
        </div>
    </div>
    <div class="page2_center">
        <div class="page2_center_div">反馈汇总附件：</div>
        <div id="getFile"></div>
    </div>
    <div class="thetextarea">
        <div>办理情况:</div>
        <div> <textarea cols="2" id="fankuidc"></textarea> </div>
    </div>
    <div class="thetextarea">
        <div>问题反馈:</div>
        <div><textarea cols="2" id="wentifankui"></textarea></div>
    </div>
    <div class="thetextarea">
        <div>下一步计划:</div>
        <div><textarea cols="2" id="xiayibunplan"></textarea></div>
    </div>
    <div class="page2_buttons">
        <button id="page2_buttons1" class="page2_buttons_div">反馈汇总</button>
<%--        <button id="page2_buttons2" class="page2_buttons_div">办理情况导出</button>--%>
    </div>
    <!-- 记录 -->
    <div class="record_caption">
        <div class="record_hr"></div>
        <div class="caption_text">我的督办记录</div>
        <div class="record_hr"></div>
    </div>
    <div class="allrecord"></div>
</div>
<div class="page page1">
    <div class="db_header_wrapper">
        <div class="mgb16">
            <label>任务名称：</label>
            <span>${mainTask.mainName}</span>
        </div>
        <div class="mgb10">
            <label>督办轮次：</label>
            <span>${specialTask.timeRound}</span>
        </div>
        <div class="flex_bet">
            <div>
                <label>已反馈任务：</label>
                <span>${feedbacked}</span>
            </div>

            <div class="mglr30">
                <label>未反馈任务：</label>
                <span>${unfeedbacked}</span>
            </div>
            <div>
<%--                <button class="db_btn db_btn_abled" type="button" id="btn_hurry">催办</button>--%>
            </div>
        </div>
    </div>
    <div class="panel_wrapper">
    </div>
</div>
<div class="page page3">
<%--    <div class="taskFlex">--%>
<%--        <div>任务名称:</div>--%>
<%--        <div class="taskName1"></div>--%>
<%--    </div>--%>
<%--    <div class="taskFlex">--%>
<%--        <div>督办伦次:</div>--%>
<%--        <div class="taskName2"></div>--%>
<%--    </div>--%>
<%--    <div class="taskLine">--%>
<%--        <div class="taskFlex">--%>
<%--            <div>已反馈任务:</div>--%>
<%--            <div class="taskName3"></div>--%>
<%--        </div>--%>
<%--        <div class="taskFlex">--%>
<%--            <div>未反馈任务:</div>--%>
<%--            <div class="taskName4"></div>--%>
<%--        </div>--%>
<%--    </div>--%>
    <div class="taskTabel"></div>
</div>
<div class="page page4">
    <div class="row">
        <div class="col-xs-12">
            <!-- PAGE CONTENT BEGINS -->
            <!-- jqGrid表格 -->
            <table id="gridTable"></table>
            <!-- jqGrid工具类 -->
            <div id="gridPager"></div>
            <!-- 查询对话框 -->
            <div style="display: none;">
                <div class="row" id="queryDialog"></div>
            </div>
            <!-- PAGE CONTENT ENDS -->
        </div><!-- /.col -->
    </div>
</div>


<%--多选上传--%>
<script src="<s:url value="/assets/js/dist/easyUploader.jq.js"></s:url>"></script>
<script src="<s:url value="/assets/js/Sortable.min.js"></s:url>"></script>
<script src="<s:url value="/assets/js/own.js"></s:url>"></script>
<%@ include file="/WEB-INF/views/include/footer.jsp" %>
<%-- 表格格式化--%>
<script>
    function lastIndexFormatter(data) {
        return data.substring(0,data.length-1)
    }

    function categoryIdFormatter(data) {
        switch (data){
            case '1':
                return '牵头';
                break;
            case '2':
                return '协办';
                break;
            default:
                return '未知';
        }
    }
    function timeRoundFormatter(data) {
        return "第"+ data + "轮"
    }

    function typeFormatter(data) {
        switch(data) {
            case '0':
                return '待签收';
                break;
            case '1':
                return '待反馈';
                break;
            case '2':
                return '已反馈';
                break;
            case '3':
                return '退回重办';
                break;
            case '4':
                return '完成';
                break;
            case '5':
                return '已签收';
                break;
            default:
                return '未知';
        }
    }
    function overdueDayFormatter(data) {
        data = parseInt(data)
        if(data>0){
            return parseInt(data)+"天"
        }else {
            return ""
        }
    }

    function feedbackBtnFormatter   (value, grid, rows, state) {
        grid.colModel.title=false
        return "<div style='color: #049CE6;display: flex;justify-content: center'>" +
            "<div style='width: 60px;cursor: pointer;border-right:1px solid #049CE6;' title='反馈汇总' id='feedbackBtn1'>反馈汇总</div>" +
            "<div style='width: 40px;cursor: pointer' title='查看' id='feedbackBtn'>查看</div>" +
            "<div style='border-left:1px solid #049CE6;width: 40px;cursor: pointer'title='删除' class='delTask'>删除</div>" +
            "<div style='width: 40px;cursor: pointer;border-left:1px solid #049CE6;' class='urge' title='催办'>催办</div>" +
            "<div style='width: 40px;cursor: pointer;border-left:1px solid #049CE6;' class='modify' title='修改'>修改</div>" +
            "</div>";
    }
</script>
<%--page3表格--%>
<script>
    // 基本路径
    var specialTask_taskMainId = document.getElementById("specialTask_taskMainId").value

    var baseUrl = "<s:url value="/taskMain/query2/"></s:url>"
    // jqgrid的表格高度
    var height = 320;
    // jqgrid表格行头的中文
    var colNames = ['','子事项','责任单位',"单位类型","任务时限", "分数","任务轮次","任务状态","逾期天数","操作"];
    var colModel = [
        {name: 'sysId', width: 60, hidden: true, key: true},
        {name: 'taskSubName', index: 'taskSubName', width: 600, editable: true},
        {name: 'deptName', index: 'deptName', width: 150, editable: true,formatter:lastIndexFormatter},
        {name: 'unitType', index: 'unitType', width: 100, editable: true,formatter:categoryIdFormatter},
        {name: 'timeLimit', index: 'timeLimit', width: 100, editable: true, },
        {name: 'score', index: 'score', width: 100, editable: true, },
        {name: 'timeRound', index: 'timeRound', width: 100, editable: true,formatter:timeRoundFormatter},
        {name: 'type', index: 'type', width: 100, editable: true,formatter:typeFormatter},
        {name: 'overdueDay', index: 'overdueDay', width: 150, editable:true,formatter:overdueDayFormatter},
        {name : 'cz', width : 250, align : "center", formatter:feedbackBtnFormatter}
    ];
    console.log("主任务Id")
    console.log(specialTask_taskMainId);
    // jqgrid的具体执行方法
    var rowIds;
    var userList;
    var type;
    jqgrid({
        gridTableId: "#gridTable",
        gridPagerId: "#gridPager",//20191126100000000278
        postData:{'taskMainId':specialTask_taskMainId},
        autoScroll: false,
        shrinkToFit: true,
        multiselect:false,
        rownumbers: true,
        onSelectRow: function (rowid, status) {
            rowIds = rowid
            //选择当前的行
            rowids = rowid
            var selectedRowValue = $("#gridTable").jqGrid('getRowData', rowid);
            var types = selectedRowValue.type;//获取任务状态
            //
        },
        ondblClickRow:function (rowid) {
            /**
             * 打开二级页面
             */
            window.parent.openapp("/taskMain/unitDetail/"+rowid,rowid,"任务详情");
        },
        loadComplete:function (data) {

        },
    });

    //点击开二级页面
    $(document).on("click","#feedbackBtn1",function(){
        parent.openapp("/taskMain/collect/"+rowIds,rowIds,"反馈汇总");
    });
    $(document).on("click","#feedbackBtn",function(){
        parent.openapp("/taskMain/unitDetail/"+rowIds,rowIds,"任务详情");
    });
    //    催办
    $(document).on("click",".urge",function () {
        $.get("/taskMain/urgeModel/"+rowIds,function (data) {
            userList = data;
            var html = "";
            for (var i = 0; i < data.length;i++){
                if (data[i].name == undefined) {
                    data[i]['name'] = ''
                }
                if(data[i].mobile == undefined) {
                    data[i]['mobile'] = ''
                }
                html += " <div class=\"form-group clearfix\">\n" +
                    "                        <label class=\"control-label col-sm-2 text-right\">姓名</label>\n" +
                    "                        <div class=\"col-sm-9\">\n" +
                    "                            <input type=\"text\" class=\"Modelname form-control\" readonly value='"+data[i].name+"'>\n" +
                    "                        </div>\n" +
                    "                    </div>\n" +
                    "                    <div class=\"form-group clearfix\">\n" +
                    "                        <label class=\"control-label col-sm-2 text-right\">电话</label>\n" +
                    "                        <div class=\"col-sm-9\">\n" +
                    "                            <input type=\"text\" class=\"Modelphone form-control\" readonly value='"+data[i].mobile+"'>\n" +
                    "                        </div>\n" +
                    "                    </div>"
            }

            $(".information").html(html);
        });
        $('#UrgeModel').modal('show'); //显示
    });

    $("#UrgeModel select").change(function () {
        $("#UrgeModel textarea").val( $(this).val());
    })

    $(".UrgeSure").click(function () {
        failure(".UrgeSure",1)
        type = $("input[name='type']:checked").val();
        if (!type){
            type = 0;
        }
        var datas = {
            taskUnitId: rowIds,
            content: $("#UrgeModel textarea").val(),
            userList:userList,
            type:type
        }
        var jsonDatas = JSON.stringify(datas);
        $.ajax({
            url:'/taskMain/saveHasten/',
            type:'POST',
            contentType: 'application/json; charset=UTF-8',
            async:false,
            dataType:'json',
            data:jsonDatas,
            success: function (data) {
                if (data.code == "200") {
                    alert("催办成功");
                    $("#UrgeModel textarea").val("");
                    $("input[name='type']").removeAttr("checked");
                } else {
                    alert("催办失败");
                }
                failure(".UrgeSure",0)
            }
        })
    })
    //审批
    $(document).on("click",".approval",function () {
        var  sysId = $(".taskMain").attr("taskMain")
        $('#approval').modal('show'); //显示
        $.get("/taskMain/approve/"+sysId,function (data) {
            $(".Modelcontent").val(data.content);
            $(".mainName").val(data.mainName);
            $(".sysId").val(data.sysId);

        })
    });
    $(".addApproval").click(function () {
        var datas = {
            status:$("[name='isApproval']:checked").val(),
            content:$(".information1 .content").val(),
            taskMainId:$(".sysId").val()
        }
        if (!datas.status){
            return alert("请选择是否通过 ")
        }
        $.post("/taskMain/approve/",datas,function (data) {
            if (data.code==200) {
                datas.status == 2 ? alert("通过审批") : alert("不通过审批")
                open(location, '_self').close();
            }else {
                alert("审批失败");
            }
        })
    })

    //攻坚反馈 takefeedback
    $(".takefeedback").click(function() {
        failure("takefeedback",0)
        var datas ={
            mainResult:$("textarea[name='mainResult']").val() ,
            mainResultFile:$("input[name=file]").val(),
            sysId:$(".taskMain").attr("taskMain"),
            mainResultFileName:$("input[name=fileName]").val()
        };
        $.ajax({
            url:"/taskMain/saveMainResult",
            type:"post",
            data:datas,
            success:function (data) {
                if(data.code == "200"){
                    alert(data.message);
                    setTimeout(function () {
                        open(location, '_self').close();
                    },50)
                }else if(data.code == "500"){
                    alert(data.message);
                }
                failure("takefeedback",1)
            }
        })
    })
    //单位反馈
    $(".takefeedbackWd").click(function() {
        failure(".takefeedbackWd",1)
        var datas ={
            mainResult:$("textarea[name='mainResult']").val() ,
            mainResultFile:$("input[name=file]").val(),
            sysId:$(".taskMain").attr("taskMain"),
            mainResultFileName:$("input[name=fileName]").val()
        }
        /* var datas ={
             content:$("textarea[name='mainResult']").val() ,
             file:$("input[name=file]").val(),
             taskMainId:$(".taskMain").attr("taskMain"),
             fileName:$("input[name=fileName]").val()
         }*/
        $.ajax({
            // url:"/taskUnit/saveMainResult",
            url:"/taskUnit/saveDuBanBackInfo",
            type:"post",
            data:datas,
            success:function (data) {
                if(data.code == "200"){
                    alert(data.message);
                    setTimeout(function () {
                        open(location, '_self').close();
                    },50)
                }else if(data.code == "500"){
                    alert(data.message);
                }
                failure(".takefeedbackWd",0)
            }
        })
    })
    //是否办结
    function taskTtatus(status) {
        var datas = {
            sysId:$(".taskMain").attr("taskMain"),
            status:status
        }
        $.ajax({
            url:"/taskMain/updateMainStatus/",
            type:"post",
            data:datas,
            success:function (data) {
                alert(data.message);
                setTimeout(function () {
                    open(location, '_self').close();
                },50)
            }
        })
    }
    /*修改任务*/
    $(document).on("click",".date_picker",function () {
        laydate({
            elem: this,
            min: minDate(),
        });
    });
    $(document).on("click",".modify",function () {
        $.get("/taskMain/getTaskUnit/"+rowIds,function (res) {
            $("input[name=getTimeLimit]").val(res.data.timeLimit)
            $("input[name=sysId]").val(res.data.sysId)
        })
        $("#modify").modal("show")
    })
    /*修改确认*/
    $(".confirmModify").click(function () {
        var datas = {
            timeLimit:$("input[name='getTimeLimit']").val(), //时限
            sysId:$("input[name='sysId']").val()
        }
        console.log(datas)
        $.post("/taskMain/editTaskUnit/",datas,function (data) {
            if (data.code == 200){
                alert("修改成功")
                reload("#gridTable");//重载
            }else {
                alert("修改失败");
            }
        })
    })
    //删除子事项
    $(document).on("click",".delTask",function () {
        if (confirm("是否删除")) {
            $.get("/taskMain/deleteUnit/" + rowIds, function (res) {
                if (res.code == "200") {
                    alert(res.message);
                    setTimeout(function () {
                        open(location, '_self').close();
                    }, 50)
                } else {
                    alert(res.message);
                }
            })
        }
    })
    //新增子事项
    $(".addTaskSub").click(function () {
        var $taskMainSysId = $(".taskMain").attr("taskMain");
        loadDialog({
            dialogTitle: '新增子事项',
            dialogUrl: "/taskMain/addTaskSub/"+$taskMainSysId,
            dialogFoot: '<button type="button" class="btn btn-primary" onclick="create()">添加</button>' +
                '<button type="button" class="btn btn-default" onclick="removeLayDate()" data-dismiss="modal">关闭</button>'
        });
    })
    //新增子事项
    function create() {
        executeSaveOrUpdate({
            formId: "#formDialog form",
            dialogId: "#formDialog",
            url: "/taskMain/addTaskSub/",
            tableId: "#gridTable",
            successMessage: "保存成功",
            successTitle: '保存对话框',
            failMessage: '保存失败',
            failTitle: '消息对话框'
        });
    }
    //新增子事项单位
    $(".addTaskUnitBtn").click(function () {
        var $taskMainSysId = $(".taskMain").attr("taskMain");
        loadDialog({
            dialogTitle: '新增单位',
            dialogUrl: "/taskMain/addTaskUnit/"+$taskMainSysId,
            dialogFoot: '<button type="button" class="btn btn-primary" onclick="createTask()">添加</button>' +
                '<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>'
        });
    })
    //新增子事项单位
    function createTask() {
        executeSaveOrUpdate({
            formId: "#formDialog form",
            dialogId: "#formDialog",
            url: "/taskMain/addTaskUnit/",
            tableId: "#gridTable",
            successMessage: "保存成功",
            successTitle: '保存对话框',
            failMessage: '保存失败',
            failTitle: '消息对话框'
        });
    }
    function minDate() {
        var now = new Date();
        return now.getFullYear() + "-" + (now.getMonth() + 1) + "-" + (now.getDate() + 1);
    }
    $(document).ready(function (){
        $(document).on("click","#date_picker",function () {
            laydate({
                elem: "#date_picker",
                min: minDate(),
            });
        });
    })
    //bug 删除时间模态框
    function removeLayDate(){
        $("#laydate_box").remove()
    }
    //任务评价
    function evaluations() {

        var eval  = $("#task-evaluations").val();
        console.log(eval)

        var datas = {
            evaluations:eval, //评价
            sysId:$(".taskMain").attr("taskMain")
        }
        console.log(datas)
        $.post("/taskMain/submitEval",datas,function (data) {
            if (data.code == 200){
                alert("评价成功")
                reload("#gridTable");//重载
            }else {
                alert("修改失败");
            }
        })

    }
    function duchaRank() {
        var eval =$("#task-evaluations").val();//评价
        var  sysId=$(".taskMain").attr("taskMain");
        parent.openapp("/taskMain/dubanfeedback?sysId="+sysId+"&eval="+eval,"接收单位")
    }
</script>
<%--顶部按钮，页面切换--%>
<script>
    var specialTask_pagetype = document.getElementById("specialTask_pagetype").value
    var bottons = document.querySelectorAll(".thebotton");
    var pages = document.querySelectorAll(".page");
    if(specialTask_pagetype == 0) {
        for (let i = 0; i < pages.length; i++) {
            bottons[i].className = "thebotton";
            pages[i].style.display = "none";
        }
        bottons[0].className = "thebotton bottonactive";
        pages[0].style.display = "block";
    }else if(specialTask_pagetype == 1){
        for (let i = 0; i < pages.length; i++) {
            bottons[i].className = "thebotton";
            pages[i].style.display = "none";
        }
        bottons[1].className = "thebotton bottonactive";
        pages[1].style.display = "block";
    }else if(specialTask_pagetype == 2){
        for (let i = 0; i < pages.length; i++) {
            bottons[i].className = "thebotton";
            pages[i].style.display = "none";
        }
        bottons[2].className = "thebotton bottonactive";
        pages[2].style.display = "block";
    }else{
        for (let i = 0; i < pages.length; i++) {
            bottons[i].className = "thebotton";
            pages[i].style.display = "none";
        }
        bottons[3].className = "thebotton bottonactive";
        pages[3].style.display = "block";
    }
    var bottons = document.querySelectorAll(".thebotton");
    var pages = document.querySelectorAll(".page");
    for (let i = 0; i < bottons.length; i++) {
        bottons[i].onclick = function () {
            for (let j = 0; j < bottons.length; j++) {
                bottons[j].className = "thebotton";
                pages[j].style.display = "none";
            }
            bottons[i].className = "thebotton bottonactive";
            pages[i].style.display = "block";
        };
    }
</script>
<%--督办详情--%>
<script>
    var specialTask_taskMainId = document.getElementById("specialTask_taskMainId").value
    var specialTask_timeRound = document.getElementById("specialTask_timeRound").value
    $(document).ready(function () {
        var $btn_finish = $("#btn_finish"); //办结按钮
        var $btn_return = $("#btn_return"); //返回重办按钮
        var $textarea = $("textarea[name=bj_explain]"); //文本域
        var $btn_hurry = $("#btn_hurry"); //催办按钮

        //催办，应该只能催办一次
        $btn_hurry.on("click", function () {
            alert("已催办，请耐心等候")
            $(this).attr("disabled", true);
            $(this).removeClass("db_btn_abled").addClass("db_btn_disabled")
            //请求
        })

        //获取文本域的内容
        $btn_finish.on("click", function () {
            console.log($textarea.val());
        })
        $btn_return.on("click",function(){
            console.log("返回重办");
        })

        $.ajax({
            url:'/taskMain/historyQianTou?taskMainId='+specialTask_taskMainId+"&timeRound="+specialTask_timeRound,
            dataType:'json',
            type:'get',
            contentType:'application/json',
            success:function (res) {
                console.log(res)
                var panel_wrapper = document.querySelector(".panel_wrapper")
                var headingHtml = '<div class="panel_title mgb10">牵头单位反馈记录</div>'
                for (let i = 0; i < res.data.length; i++) {
                    headingHtml += '<div class="panel panel-default">'+
                                    '<div class="panel-heading">'+
                                        ' <span>子任务事项：</span>'+
                                        '<span>'+res.data[i].taskSubName+'</span>'+
                                    ' </div>'+
                                    '<div class="panel-body">'+
                                    '</div>'+
                                '</div>'
                }
                panel_wrapper.innerHTML = headingHtml
                var panel_bodys = document.querySelectorAll(".panel-body")
                for (let i = 0; i < res.data.length; i++) {
                    var bodyHtml = ""
                    for (let j = 0; j < res.data[i].taskSubList.length; j++) {
                        let file_div = ""
                        if(res.data[i].taskSubList[j].fileDto == ""||res.data[i].taskSubList[j].fileDto==undefined||res.data[i].taskSubList[j].fileDto==null){
                            file_div = '<div class="download_text"> 无</div>'
                        }else{
                            for (let k = 0; k < res.data[i].taskSubList[j].fileDto.length; k++) {
                                file_div += '<div>'+
                                        '<input type="hidden" class="xqxiazaiwenjianid" value="'+ res.data[i].taskSubList[j].fileDto[k].fileId +'"> ' +
                                        '<a href="javascript:;" class="file_name xqxiazaiwenjianming">'+ res.data[i].taskSubList[j].fileDto[k].fileName+'</a>'+
                                        '<button class="btn_download xqxiazaiwenjiananniu" type="button" >下载</button>'+
                                    '</div>'
                            }
                        }
                        bodyHtml += '<div class="flex_bet mgb10">'+
                                '<input type="hidden" class="qiantoutaskUnitId" value="'+ res.data[i].taskSubList[j].taskUnitId +'">'+
                                '<input type="hidden" class="qiantoubackId" value="'+ res.data[i].taskSubList[j].sysId +'">'+
                                '<input type="hidden" class="qiantoustatus" value="'+ res.data[i].taskSubList[j].status +'">'+
                                        '<div>'+
                                            '<label>牵头单位：</label>'+
                                            '<span>'+ res.data[i].taskSubList[j].deptName +'</span>'+
                                        '</div>'+
                                        '<div class="mglr30">'+
                                            '<label>反馈时间：</label>'+
                                            '<span>'+ res.data[i].taskSubList[j].updDate +' '+ res.data[i].taskSubList[j].updTime+'</span>'+
                                        '</div>'+
                                    '</div>'+
                                    '<div class="mgb10">'+
                                        '<label>办理情况：</label>'+
                                        '<span>'+ res.data[i].taskSubList[j].content + ' ' + '</span>'+
                                    '</div>'+
                                    '<div class="mgb10">'+
                                        '<label>存在问题：</label>'+
                                        '<span>'+ res.data[i].taskSubList[j].problem +'</span>'+
                                    '</div>'+
                                    '<div class="mgb10">'+
                                        '<label>下步计划：</label>'+
                                        '<span>'+ res.data[i].taskSubList[j].plan +'</span>'+
                                    '</div>'+
                                    '<div class="flex_bet">'+
                                         '<label>附件下载：</label>'+
                                        '<div>'+
                                            file_div +
                                        '</div>'+
                                    '</div>'+
                                    '<div class="form_wrapper">'+
                                    '<div class="item_line mgb10 banjieshurukuang">'+
                                    '<label>办结说明：</label>'+
                                    '<textarea class="v_mid banjieshuoming" name="bj_explain" rows="5"></textarea>'+
                                    '</div>'+
                                    '<div class="item_line">'+
                                    '<label>是否办结：</label>'+
                                    '<button type="button" class="btn_finish mgr10 qiantoubanjie" id="btn_finish" >办结</button>'+
                                    '<button type="button" class="btn_return qiantoufhcb" id="btn_return">返回重办</button>'+
                                    ' </div>'+
                                    '</div>'+
                                    '<hr style="background-color: #000;" />'
                    }
                    panel_bodys[i].innerHTML = bodyHtml
                }

                var xqxiazaiwenjianid = document.querySelectorAll(".xqxiazaiwenjianid")
                var xqxiazaiwenjianming = document.querySelectorAll(".xqxiazaiwenjianming")
                var xqxiazaiwenjiananniu = document.querySelectorAll(".xqxiazaiwenjiananniu")
                for (let i = 0; i < xqxiazaiwenjiananniu.length; i++) {
                    xqxiazaiwenjiananniu[i].onclick = function(){
                        window.open('/filesUpload/download?id='+xqxiazaiwenjianid[i].value+'&name='+xqxiazaiwenjianming[i].innerText)
                    }
                }
                var qiantoubanjie = document.querySelectorAll(".qiantoubanjie")
                var qiantoufhcb = document.querySelectorAll(".qiantoufhcb")
                var qiantoustatus = document.querySelectorAll(".qiantoustatus")
                var banjieshurukuang =  document.querySelectorAll(".banjieshurukuang")
                for (let i = 0; i < qiantoustatus.length; i++) {
                    if(qiantoustatus[i].value == 1){
                        qiantoubanjie[i].disabled = true
                        qiantoubanjie[i].style.cursor = "not-allowed"
                        qiantoubanjie[i].innerText = "已办结"
                        qiantoubanjie[i].style.backgroundColor = "grey"
                        banjieshurukuang[i].style.display = "none"
                    }
                }
                var qiantoutaskUnitId = document.querySelectorAll(".qiantoutaskUnitId")
                var qiantoubackId = document.querySelectorAll(".qiantoubackId")
                var banjieshuoming =  document.querySelectorAll(".banjieshuoming")
                for (let i = 0; i < qiantoubanjie.length; i++) {
                    qiantoubanjie[i].onclick = function () {
                        let params = {
                            taskUnitId:qiantoutaskUnitId[i].value,
                            backId:qiantoubackId[i].value,
                            status:1,
                            dubanExplain:banjieshuoming[i].value
                        }
                        $.ajax({
                            url: '/taskMain/handleQianTou',
                            dataType: 'json',
                            type: 'POST',
                            contentType: 'application/json',
                            data:JSON.stringify(params),
                            success: function (res) {
                                console.log("999999999")
                                console.log(res)
                                if(res.code == 200){
                                    alert("办结成功!")
                                    pageshuaxin()
                                }else{
                                    alert("办结失败!")
                                }
                            }
                        })
                    }
                }
                for (let i = 0; i < qiantoufhcb.length; i++) {
                    qiantoufhcb[i].onclick = function () {
                        let params = {
                            taskUnitId:qiantoutaskUnitId[i].value,
                            backId:qiantoubackId[i].value,
                            status:2,
                            dubanExplain:banjieshuoming[i].value
                        }
                        $.ajax({
                            url: '/taskMain/handleQianTou',
                            dataType: 'json',
                            type: 'POST',
                            contentType: 'application/json',
                            data:JSON.stringify(params),
                            success: function (res) {
                                console.log("999999999")
                                console.log(res)
                                if(res.code == 200){
                                    alert("办结成功!")
                                    pageshuaxin()
                                }else{
                                    alert("办结失败!")
                                }
                            }
                        })
                    }
                }
            }
        });
    })
   function  pageshuaxin(){
       $.ajax({
           url:'/taskMain/historyQianTou?taskMainId='+specialTask_taskMainId+"&timeRound="+specialTask_timeRound,
           dataType:'json',
           type:'get',
           contentType:'application/json',
           success:function (res) {
               console.log(res)
               var panel_wrapper = document.querySelector(".panel_wrapper")
               var headingHtml = '<div class="panel_title mgb10">牵头单位反馈记录</div>'
               for (let i = 0; i < res.data.length; i++) {
                   headingHtml += '<div class="panel panel-default">'+
                       '<div class="panel-heading">'+
                       ' <span>子任务事项：</span>'+
                       '<span>'+res.data[i].taskSubName+'</span>'+
                       ' </div>'+
                       '<div class="panel-body">'+
                       '</div>'+
                       '</div>'
               }
               panel_wrapper.innerHTML = headingHtml
               var panel_bodys = document.querySelectorAll(".panel-body")
               for (let i = 0; i < res.data.length; i++) {
                   var bodyHtml = ""
                   for (let j = 0; j < res.data[i].taskSubList.length; j++) {
                       let file_div = ""
                       if(res.data[i].taskSubList[j].fileDto == ""||res.data[i].taskSubList[j].fileDto==undefined||res.data[i].taskSubList[j].fileDto==null){
                           file_div = '<div class="download_text"> 无</div>'
                       }else{
                           for (let k = 0; k < res.data[i].taskSubList[j].fileDto.length; k++) {
                               file_div += '<div>'+
                                   '<input type="hidden" class="xqxiazaiwenjianid" value="'+ res.data[i].taskSubList[j].fileDto[k].fileId +'"> ' +
                                   '<a href="javascript:;" class="file_name xqxiazaiwenjianming">'+ res.data[i].taskSubList[j].fileDto[k].fileName+'</a>'+
                                   '<button class="btn_download xqxiazaiwenjiananniu" type="button" >下载</button>'+
                                   '</div>'
                           }
                       }
                       bodyHtml += '<div class="flex_bet mgb10">'+
                           '<input type="hidden" class="qiantoutaskUnitId" value="'+ res.data[i].taskSubList[j].taskUnitId +'">'+
                           '<input type="hidden" class="qiantoubackId" value="'+ res.data[i].taskSubList[j].sysId +'">'+
                           '<input type="hidden" class="qiantoustatus" value="'+ res.data[i].taskSubList[j].status +'">'+
                           '<div>'+
                           '<label>牵头单位：</label>'+
                           '<span>'+ res.data[i].taskSubList[j].deptName +'</span>'+
                           '</div>'+
                           '<div class="mglr30">'+
                           '<label>反馈时间：</label>'+
                           '<span>'+ res.data[i].taskSubList[j].updDate +' '+ res.data[i].taskSubList[j].updTime+'</span>'+
                           '</div>'+
                           '</div>'+
                           '<div class="mgb10">'+
                           '<label>办理情况：</label>'+
                           '<span>'+ res.data[i].taskSubList[j].content + ' ' + res.data[i].taskSubList[j].userName +'</span>'+
                           '</div>'+
                           '<div class="mgb10">'+
                           '<label>存在问题：</label>'+
                           '<span>'+ res.data[i].taskSubList[j].problem +'</span>'+
                           '</div>'+
                           '<div class="mgb10">'+
                           '<label>下步计划：</label>'+
                           '<span>'+ res.data[i].taskSubList[j].plan +'</span>'+
                           '</div>'+
                           '<div class="flex_bet">'+
                           '<label>附件下载：</label>'+
                           '<div>'+
                           file_div +
                           '</div>'+
                           '</div>'+
                           '<div class="form_wrapper">'+
                           '<div class="item_line mgb10 banjieshurukuang">'+
                           '<label>办结说明：</label>'+
                           '<textarea class="v_mid banjieshuoming" name="bj_explain" rows="5"></textarea>'+
                           '</div>'+
                           '<div class="item_line">'+
                           '<label>是否办结：</label>'+
                           '<button type="button" class="btn_finish mgr10 qiantoubanjie" id="btn_finish" >办结</button>'+
                           '<button type="button" class="btn_return qiantoufhcb" id="btn_return">返回重办</button>'+
                           ' </div>'+
                           '</div>'+
                           '<hr style="background-color: #000;" />'
                   }
                   panel_bodys[i].innerHTML = bodyHtml
               }

               var xqxiazaiwenjianid = document.querySelectorAll(".xqxiazaiwenjianid")
               var xqxiazaiwenjianming = document.querySelectorAll(".xqxiazaiwenjianming")
               var xqxiazaiwenjiananniu = document.querySelectorAll(".xqxiazaiwenjiananniu")
               for (let i = 0; i < xqxiazaiwenjiananniu.length; i++) {
                   xqxiazaiwenjiananniu[i].onclick = function(){
                       window.open('/filesUpload/download?id='+xqxiazaiwenjianid[i].value+'&name='+xqxiazaiwenjianming[i].innerText)
                   }
               }
               var qiantoubanjie = document.querySelectorAll(".qiantoubanjie")
               var qiantoufhcb = document.querySelectorAll(".qiantoufhcb")
               var qiantoustatus = document.querySelectorAll(".qiantoustatus")
               var banjieshurukuang =  document.querySelectorAll(".banjieshurukuang")
               for (let i = 0; i < qiantoustatus.length; i++) {
                   if(qiantoustatus[i].value == 1){
                       qiantoubanjie[i].disabled = true
                       qiantoubanjie[i].style.cursor = "not-allowed"
                       qiantoubanjie[i].innerText = "已办结"
                       qiantoubanjie[i].style.backgroundColor = "grey"
                       banjieshurukuang[i].style.display = "none"
                   }
               }
               var qiantoutaskUnitId = document.querySelectorAll(".qiantoutaskUnitId")
               var qiantoubackId = document.querySelectorAll(".qiantoubackId")
               var banjieshuoming =  document.querySelectorAll(".banjieshuoming")
               for (let i = 0; i < qiantoubanjie.length; i++) {
                   qiantoubanjie[i].onclick = function () {
                       let params = {
                           taskUnitId:qiantoutaskUnitId[i].value,
                           backId:qiantoubackId[i].value,
                           status:1,
                           dubanExplain:banjieshuoming[i].value
                       }
                       $.ajax({
                           url: '/taskMain/handleQianTou',
                           dataType: 'json',
                           type: 'POST',
                           contentType: 'application/json',
                           data:JSON.stringify(params),
                           success: function (res) {
                               console.log("999999999")
                               console.log(res)
                               if(res.code == 200){
                                   alert("办结成功!")
                                   pageshuaxin()
                               }else{
                                   alert("办结失败!")
                               }
                           }
                       })
                   }
               }
               for (let i = 0; i < qiantoufhcb.length; i++) {
                   qiantoufhcb[i].onclick = function () {
                       let params = {
                           taskUnitId:qiantoutaskUnitId[i].value,
                           backId:qiantoubackId[i].value,
                           status:2,
                           dubanExplain:banjieshuoming[i].value
                       }
                       $.ajax({
                           url: '/taskMain/handleQianTou',
                           dataType: 'json',
                           type: 'POST',
                           contentType: 'application/json',
                           data:JSON.stringify(params),
                           success: function (res) {
                               console.log("999999999")
                               console.log(res)
                               if(res.code == 200){
                                   alert("办结成功!")
                                   pageshuaxin()
                               }else{
                                   alert("办结失败!")
                               }
                           }
                       })
                   }
               }
           }
       });
   }
</script>
<%--反馈汇总--%>
<script>
    var  specialTask_type_div = document.getElementById("specialTask_type_div")
    var specialTask_type =  document.getElementById("specialTask_type").value
    if(specialTask_type==0){
        specialTask_type_div.innerText = "待签收"
    }else if(specialTask_type==1){
        specialTask_type_div.innerText = "待反馈"
    }else if(specialTask_type==2){
        specialTask_type_div.innerText = "已反馈"
    }else if(specialTask_type==3){
        specialTask_type_div.innerText = "退回"
    }else if(specialTask_type==4){
        specialTask_type_div.innerText = "完成"
    }else if(specialTask_type==5){
        specialTask_type_div.innerText = "已签收"
    }




    <%--多文件上传--%>
    var fileStr = "";//id字符串拼接
    var fileNameStr = "";//文件名字符串拼接
    var mainResultFile = ""
    var oldName = ""
    var uploader = easyUploader({
        id: "getFile",
        accept: '.jpg,.png,.doc,.docx,.pdf,.xls,.xlsx,.ppt,.pptx',
        action: '/filesUpload/uploadFiles',
        dataFormat: 'formData',
        maxCount: 10,//允许上传的个数
        maxSize: 2000,//允许上传最大的容量
        multiple: true,
        data: null,
        beforeUpload: function (file, data, args) {
        },
        onChange: function (fileList) {
        },
        onRemove: function (removedFiles, files) {
            console.log('onRemove', removedFiles);
        },
        onSuccess: function (res) {
            console.log('onSuccess', res);
            if (res.data !== undefined && res.data[0] !== undefined) {
                    //拼接文件id 和 文件名
                    $("input[name='file']").val(fileStr += res.data[0].sysid + ",");
                    $("input[name='fileName']").val(fileNameStr += res.data[0].oldName + ",");
                    mainResultFile += res.data[0].sysid + ","
                    oldName += res.data[0].oldName + ","
            }
        },
        onError: function (err) {
            console.log('onError', err);
        },
    });
    var specialTask_taskMainId = document.getElementById("specialTask_taskMainId").value
    var specialTask_timeRound = document.getElementById("specialTask_timeRound").value
    var params = {
        taskMainId:specialTask_taskMainId,
        timeRound:specialTask_timeRound
    }
    $.ajax({
        url:'/taskMain/dubanfeedback/getsontask',
        dataType:'json',
        type:'post',
        contentType:'application/json',
        data:JSON.stringify(params),
        success:function (res) {
            console.log("danyanjijijijiji")
            console.log(res)
            var dataInfo = []
            for (let i = 0; i < res.data.length; i++) {
                dataInfo.push({
                    sysId: res.data[i].sysId,
                    deptName: res.data[i].deptName,
                    deptRank: res.data[i].deptRank,
                    deptId: res.data[i].deptId,
                    mainTaskId:res.data[i].mainTaskId,
                    evaluation: res.data[i].evaluations,
                })
            }
            var pailie = "";
            for (let i = 0; i < dataInfo.length; i++) {
                if (dataInfo[i].evaluation == "好") {
                    pailie +=
                        '<div class="page2_bottom_info_tr pailies">' +
                            '<div class="page2_bottom_info_td" style="display: none">' +
                                dataInfo[i].sysId +
                            '</div>'+
                            '<div class="page2_bottom_info_td" style="display: none">' +
                                dataInfo[i].deptRank +
                            '</div>'+
                            '<div class="page2_bottom_info_td" style="display: none">' +
                                dataInfo[i].deptId +
                            '</div>'+
                            '<div class="page2_bottom_info_td" style="display: none">' +
                                dataInfo[i].mainTaskId +
                            '</div>'+
                            '<div class="page2_bottom_info_td">' +
                                dataInfo[i].deptName +
                            '</div>' +
                            '<div class="page2_bottom_info_td" style="color:green">' +
                                dataInfo[i].evaluation +
                            '</div>' +
                        '</div>';
                }
                if (dataInfo[i].evaluation == "中") {
                    pailie +=
                        '<div class="page2_bottom_info_tr pailies">' +
                            '<div class="page2_bottom_info_td" style="display: none">' +
                                dataInfo[i].sysId +
                            '</div>'+
                            '<div class="page2_bottom_info_td" style="display: none">' +
                                dataInfo[i].deptRank +
                            '</div>'+
                            '<div class="page2_bottom_info_td" style="display: none">' +
                                dataInfo[i].deptId +
                            '</div>'+
                            '<div class="page2_bottom_info_td" style="display: none">' +
                                dataInfo[i].mainTaskId +
                            '</div>'+
                            '<div class="page2_bottom_info_td">' +
                                dataInfo[i].deptName +
                            '</div>' +
                            '<div class="page2_bottom_info_td" style="color:orange">' +
                                dataInfo[i].evaluation +
                            '</div>' +
                        '</div>';
                }
                if (dataInfo[i].evaluation == "差") {
                    pailie +=
                        '<div class="page2_bottom_info_tr pailies">' +
                            '<div class="page2_bottom_info_td" style="display: none">' +
                                dataInfo[i].sysId +
                            '</div>'+
                            '<div class="page2_bottom_info_td" style="display: none">' +
                                dataInfo[i].deptRank +
                            '</div>'+
                            '<div class="page2_bottom_info_td" style="display: none">' +
                                dataInfo[i].deptId +
                            '</div>'+
                            '<div class="page2_bottom_info_td" style="display: none">' +
                                dataInfo[i].mainTaskId +
                            '</div>'+
                            '<div class="page2_bottom_info_td">' +
                                dataInfo[i].deptName +
                            '</div>' +
                            '<div class="page2_bottom_info_td" style="color:red">' +
                                dataInfo[i].evaluation +
                            '</div>' +
                        '</div>';
                }
                if (dataInfo[i].evaluation == "-") {
                    pailie +=
                        '<div class="page2_bottom_info_tr pailies">' +
                            '<div class="page2_bottom_info_td" style="display: none">' +
                                dataInfo[i].sysId +
                            '</div>'+
                            '<div class="page2_bottom_info_td" style="display: none">' +
                                dataInfo[i].deptRank +
                            '</div>'+
                            '<div class="page2_bottom_info_td" style="display: none">' +
                                dataInfo[i].deptId +
                            '</div>'+
                            '<div class="page2_bottom_info_td" style="display: none">' +
                                dataInfo[i].mainTaskId +
                            '</div>'+
                            '<div class="page2_bottom_info_td">' +
                                dataInfo[i].deptName +
                            '</div>' +
                            '<div class="page2_bottom_info_td" style="color:green">' +
                                dataInfo[i].evaluation +
                            '</div>' +
                        '</div>';
                }
            }
            // $(".page2_bottom_info_bottom").html((hao + zhong + cha+ wu).split("undefined").join(""))
            $(".page2_bottom_info_bottom").html(pailie)
        }
    })
    new Sortable(dubanChance, {
        animation: 150,
        group: 'shared', // set both lists to same group
        // 元素被选中
        onChoose: function (/**Event*/evt) {
            evt.oldIndex;  // element index within parent
        },
        // 元素未被选中的时候（从选中到未选中）
        onUnchoose: function(/**Event*/evt) {
            // same properties as onEnd
        },
        // 开始拖拽的时候
        onStart: function (/**Event*/evt) {
            evt.oldIndex;  // element index within parent
        },
        // 结束拖拽
        onEnd: function (/**Event*/evt) {
            var itemEl = evt.item;  // dragged HTMLElement
            evt.to;    // target list
            evt.from;  // previous list
            evt.oldIndex;  // element's old index within old parent
            evt.newIndex;  // element's new index within new parent
            evt.clone // the clone element
            evt.pullMode;  // when item is in another sortable: `"clone"` if cloning, `true` if moving
            console.log("laihuhuhuhuhuhu")
            console.log(evt)
        },
        // 元素从一个列表拖拽到另一个列表
        onAdd: function (/**Event*/evt) {
            // same properties as onEnd
        },
        // 列表内元素顺序更新的时候触发
        onUpdate: function (/**Event*/evt) {
            // same properties as onEnd
        },
        // 列表的任何更改都会触发
        onSort: function (/**Event*/evt) {
            // same properties as onEnd
        },
        // 元素从列表中移除进入另一个列表
        onRemove: function (/**Event*/evt) {
            // same properties as onEnd
        },
        // 试图拖拽一个filtered的元素
        onFilter: function (/**Event*/evt) {
            var itemEl = evt.item;  // HTMLElement receiving the `mousedown|tapstart` event.
        },
        // 拖拽移动的时候
        onMove: function (/**Event*/evt, /**Event*/originalEvent) {
            evt.dragged; // dragged HTMLElement
            evt.draggedRect; // DOMRect {left, top, right, bottom}
            evt.related; // HTMLElement on which have guided
            evt.relatedRect; // DOMRect
            evt.willInsertAfter; // Boolean that is true if Sortable will insert drag element after target by default
            originalEvent.clientY; // mouse position
            // console.log(originalEvent,evt)
        },
        // clone一个元素的时候触发
        onClone: function (/**Event*/evt) {
            var origEl = evt.item;
            var cloneEl = evt.clone;
        },
        // 拖拽元素改变位置的时候
        onChange: function(/**Event*/evt) {
            // console.log(evt.newIndex )
        }
    });
    if(document.getElementById("specialTask_type_div").innerText == "完成"){
        console.log("danyanji")
        $("#page2_buttons1").css("disabled",true)
        $("#page2_buttons1").css("background-color","rgba(0,0,0,0.4)")
        $("#page2_buttons1").css("cursor","not-allowed")
    }else{
        $("#page2_buttons1").on("click", function () {
                    var _this = this
                    var pailies = document.querySelectorAll(".pailies")
                    var specialTask_sysId = document.getElementById("specialTask_sysId").value
                    var fankuidc = document.getElementById("fankuidc").value
                    var allArr = []
                    for (let i = 0; i < pailies.length; i++) {
                        allArr.push({
                            sysId :pailies[i].childNodes[0].innerText,
                            deptRank :i+1,
                            deptId :pailies[i].childNodes[2].innerText,
                            mainTaskId :pailies[i].childNodes[3].innerText,
                            deptName :pailies[i].childNodes[4].innerText,
                            evaluations :pailies[i].childNodes[5].innerText,
                        })
            }
            var params = {
                specialId:specialTask_sysId,
                file:mainResultFile,
                fileName:oldName,
                mainResult:fankuidc,
                problem:$('#wentifankui').val(),
                nextPlan:$('#xiayibunplan').val(),
                listRanks:allArr
            }
            console.log(params)
            $.ajax({
                url: '/taskMain/submitEval',
                dataType: 'json',
                type: 'post',
                contentType: 'application/json',
                data: JSON.stringify(params),
                success: function (res) {
                    console.log(res)
                    if(res.code == 200){
                        alert("反馈成功！")
                        $(_this).attr("disabled", true);
                        $(_this).addClass("page2_buttons_click")
                        location.reload();
                    }else{
                       // res.message
                        alert(res.message)
                    }
                }
            })
        })
    }
    $("#page2_buttons2").on("click", function () {
        alert("正在导出办理情况，请稍候")
        $(this).attr("disabled", true);
        $(this).addClass("page2_buttons_click")
    })
   // 我的督办记录
    function orderSort(attr) {
        return function (obj1, obj2) {
            var value1 = obj1[attr];
            var value2 = obj2[attr];
            if (!isNaN(Number(value1)) && !isNaN(Number(value2))) {
                var val1 = Number(value1);
                var val2 = Number(value2);
                value1 = val1;
                value2 = val2;
            }
            if (value1 > value2) {
                return -1;
            } else if (value1 < value2) {
                return 1;
            } else {
                return 0;
            }
        };
    }
    var specialTask_taskMainId = document.getElementById("specialTask_taskMainId").value
    var specialTask_timeRound = document.getElementById("specialTask_timeRound").value
    $.ajax({
        url:'/taskMain/historyDuBan?taskMainId='+specialTask_taskMainId+"&timeRound="+specialTask_timeRound,
        dataType:'json',
        type:'get',
        contentType:'application/json',
        success:function (res) {
            console.log("99999999999999999999999999999")
            console.log(res)
            var html="";
            var dataArr = []
            for (let i = 0; i < res.data.length; i++) {
                dataArr.push({
                    time:res.data[i].createDate + " " + res.data[i].createTime,
                    content:res.data[i].content,
                    problem:res.data[i].problem,
                    plan:res.data[i].plan,
                    fileDto:res.data[i].fileDto,
                })
            }
            var newdata =  dataArr.sort(orderSort("time"))
            var html = ""
            for (let i = 0; i < newdata.length; i++) {
                let file_div = ""
                if(newdata[i].fileDto == ""||newdata[i].fileDto==undefined||newdata[i].fileDto==null){
                    file_div = '<div class="download_text"> 无</div>'
                }else{
                    for (let j = 0; j < newdata[i].fileDto.length; j++) {
                        file_div += '<div class="download_text"> ' +
                            '<input type="hidden" class="xiazaiwenjianid" value="'+ newdata[i].fileDto[j].fileId +'"> ' +
                            '<a href="javascript:;" style="display: inline-block;width: 150px;" class="xiazaiwenjianming">'+newdata[i].fileDto[j].fileName+'</a>' +
                            '<div class="download_botton xiazaiwenjiananniu">下载</div>' +
                            '</div>'
                    }
                }
                html +=  '<div class="record">'+
                    '<div class="record_title">'+
                    '<div class="record_text1">反馈时间：</div>'+
                    '<div class="record_text2">'+newdata[i].time+'</div>'+
                    '</div>'+
                    '<div class="record_div">'+
                    '<div class="record_text1">办理情况：</div>'+
                    '<div class="record_text3">'+newdata[i].content+'</div>'+
                    '</div>'+
                    '<div class="record_div">'+
                    '<div class="record_text1">存在问题：</div>'+
                    '<div class="record_text3">'+newdata[i].problem+'</div>'+
                    '</div>'+
                    '<div class="record_div">'+
                    '<div class="record_text1">下步计划：</div>'+
                    '<div class="record_text3">'+newdata[i].plan+'</div>'+
                    '</div>'+
                    '<div class="record_div2">'+
                    '<div class="record_text1">附件下载：</div>'+
                    '<div class="record_text3">'+
                    file_div +
                    '</div>'+
                    '</div>'+
                    '</div>'
            }
            var allrecord = document.querySelector(".allrecord")
            allrecord.innerHTML = html
            var xiazaiwenjianid = document.querySelectorAll(".xiazaiwenjianid")
            var xiazaiwenjianming = document.querySelectorAll(".xiazaiwenjianming")
            var xiazaiwenjiananniu = document.querySelectorAll(".xiazaiwenjiananniu")
            for (let i = 0; i < xiazaiwenjiananniu.length; i++) {
                xiazaiwenjiananniu[i].onclick = function(){
                    window.open('/filesUpload/download?id='+xiazaiwenjianid[i].value+'&name='+xiazaiwenjianming[i].innerText)
                }
            }

        }
    });
</script>
<%--督察流程记录--%>
<script>
    $('.taskName1').html('XX任务')
    $('.taskName2').html('第10轮')
    $('.taskName3').html('9项')
    $('.taskName4').html('0项')
    var specialTask_sysId = document.getElementById("specialTask_sysId").value
    $.ajax({
        url:'/taskMain/liuchengLog?taskUnitId='+ specialTask_sysId,
        dataType:'json',
        type:'get',
        contentType:'application/json',
        success:function (res) {
            console.log(res)
            var item = '<div>共'+ res.data.length +'条反馈记录</div>'
            for(let i=0;i<res.data.length;i++){
                item += "<div class='taskTr'>"+'<div>'+ res.data[i].updDate + " "+ res.data[i].createTime +'</div>' + '<div>'+ res.data[i].content +'</div>' +"</div>"
            }
            $('.taskTabel').html(item)
        }
    });
</script>
<%--page1上部数据--%>
<script type="text/javascript">
    var specialTask_type = document.getElementById("specialTask_type").value
    var specialTask_type_div = document.getElementById("specialTask_type_div")
    var specialTask_evaluations = document.getElementById("specialTask_evaluations").value
    var specialTask_evaluations_div = document.getElementById("specialTask_evaluations_div")
    var mainTask_mainResult = document.getElementById("mainTask_mainResult").value
    var mainTask_mainResult_div = document.getElementById("mainTask_mainResult_div");
    if(mainTask_mainResult == null||mainTask_mainResult==""||mainTask_mainResult==undefined){
        mainTask_mainResult_div.innerText = "无"
    }
    if(specialTask_type==0){
        specialTask_type_div.innerText = "待签收"
    }else if(specialTask_type==1){
        specialTask_type_div.innerText = "待反馈"
    }else if(specialTask_type==2){
        specialTask_type_div.innerText = "已反馈"
    }else if(specialTask_type==3){
        specialTask_type_div.innerText = "退回"
    }else if(specialTask_type==4){
        specialTask_type_div.innerText = "完成"
    }else if(specialTask_type==5){
        specialTask_type_div.innerText = "已签收"
    }
    if(specialTask_evaluations == 1){
        specialTask_evaluations_div.innerText = "好"
    }else if(specialTask_evaluations == 2){
        specialTask_evaluations_div.innerText = "中"
    }else if(specialTask_evaluations == 3){
        specialTask_evaluations_div.innerText = "差"
    }
</script>

<script type="text/javascript">
    new Sortable(example2, {
        animation: 150,
        group: 'shared', // set both lists to same group
        // 元素被选中
        onChoose: function (/**Event*/evt) {
            evt.oldIndex;  // element index within parent
        },
        // 元素未被选中的时候（从选中到未选中）
        onUnchoose: function(/**Event*/evt) {
            // same properties as onEnd
        },
        // 开始拖拽的时候
        onStart: function (/**Event*/evt) {
            evt.oldIndex;  // element index within parent
        },
        // 结束拖拽
        onEnd: function (/**Event*/evt) {
            var itemEl = evt.item;  // dragged HTMLElement
            evt.to;    // target list
            evt.from;  // previous list
            evt.oldIndex;  // element's old index within old parent
            evt.newIndex;  // element's new index within new parent
            evt.clone // the clone element
            evt.pullMode;  // when item is in another sortable: `"clone"` if cloning, `true` if moving
        },

        // 元素从一个列表拖拽到另一个列表
        onAdd: function (/**Event*/evt) {
            // same properties as onEnd
        },
        // 列表内元素顺序更新的时候触发
        onUpdate: function (/**Event*/evt) {
            // same properties as onEnd
        },
        // 列表的任何更改都会触发
        onSort: function (/**Event*/evt) {
            // same properties as onEnd
        },
        // 元素从列表中移除进入另一个列表
        onRemove: function (/**Event*/evt) {
            // same properties as onEnd
        },
        // 试图拖拽一个filtered的元素
        onFilter: function (/**Event*/evt) {
            var itemEl = evt.item;  // HTMLElement receiving the `mousedown|tapstart` event.
        },
        // 拖拽移动的时候
        onMove: function (/**Event*/evt, /**Event*/originalEvent) {
            evt.dragged; // dragged HTMLElement
            evt.draggedRect; // DOMRect {left, top, right, bottom}
            evt.related; // HTMLElement on which have guided
            evt.relatedRect; // DOMRect
            evt.willInsertAfter; // Boolean that is true if Sortable will insert drag element after target by default
            originalEvent.clientY; // mouse position
            // console.log(originalEvent,evt)
        },
        // clone一个元素的时候触发
        onClone: function (/**Event*/evt) {
            var origEl = evt.item;
            var cloneEl = evt.clone;
        },
        // 拖拽元素改变位置的时候
        onChange: function(/**Event*/evt) {
            // console.log(evt.newIndex )
        }
    });
</script>
</body>
</html>